package bookshopSM;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.border.BevelBorder;

//this.getContentPane().setBackground(new Color(100,100,100));//设置背景色

public class DrawPanel extends JPanel {
    public Image img=new ImageIcon("bgp.jpg").getImage();

    public void setimg(String str){
        img = new ImageIcon(str).getImage();
    }

    public void paintComponent(Graphics g){
        super.paintComponent(g);
        g.setColor(Color.red);
        g.drawImage(img, 0, 0, 270, 550, null);
        setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
        validate();
    }

    public void draw(){
        repaint();
    }

}
